<?php
include("myzhuaqu.php");
//echo "http://collect1.longsunhd.com/v.php?url=".urlencode("http://vodcdn.nntv.cn/vod/local/2017/12/01/30EI2p3_1512091052627_HBJ4n3l_2222.mp4");
//exit;
//http://collect1.longsunhd.com/v.php?XDEBUG_SESSION_START=20171202112440&url=http%253A%252F%252Fvodcdn.nntv.cn%252Fvod%252Flocal%252F2017%252F12%252F01%252F30EI2p3_1512091052627_HBJ4n3l_2222.mp4
$url=preg_replace("/\s*http\:\/\/.*http\:\/\//isx","http://",urldecode($_GET[url]));
preg_match("/http\:\/\/(.*)\//Uisx",$url,$nn);$host=$nn[1];

$Referer=($Referer=="")?"http://".$host:$Referer;
$cookie=($cookie!="")?"\r\nCookie: ".trim($cookie)."":"";


$Referer="http://www.nntv.cn/player/nntvplayer.swf";
$option = array(
    'http' => array(
        'header' => "Referer:$Referer")
);
$filenr=file_get_contents($url, false,stream_context_create($option));
fopenw("1.mp4",$filenr);
PutMovie("1.mp4");

function PutMovie($file) {
    header("Content-type: video/mp4");
    header("Accept-Ranges: bytes");

    $size = filesize($file);
    if(isset($_SERVER['HTTP_RANGE'])){
        header("HTTP/1.1 206 Partial Content");
        list($name, $range) = explode("=", $_SERVER['HTTP_RANGE']);
        list($begin, $end) =explode("-", $range);
        if($end == 0) $end = $size - 1;
    }
    else {
        $begin = 0; $end = $size - 1;
    }
    header("Content-Length: " . ($end - $begin + 1));
    header("Content-Disposition: filename=".basename($file));
    header("Content-Range: bytes ".$begin."-".$end."/".$size);

    $fp = fopen($file, 'rb');
    fseek($fp, $begin);
    while(!feof($fp)) {
        $p = min(1024, $end - $begin + 1);
        $begin += $p;
        echo fread($fp, $p);
    }
    fclose($fp);
}

?>
?>